import { Getname } from "./filter";
import Cookie from "js-cookie";

const init = () => {
	Getname(Cookie.get("zm-iam-token") as string);
};

/**
 * @description 有权限的应用下发权限cookie
 *
 */
Cookie.set("zm-iam-token", "17338110056", {
	// domain: ".",
	expires: 30
});

window.sessionStorage.setItem("zm-iam-token", Cookie.get("zm-iam-token") + "");

init();

interface Pointer {
	x: number;
	readonly y: number;
}

type Keys<T> = {
	// [P in keyof Pointer]: Pointer[P];
	[P in keyof T]: T[P];
};

let pointer: Pointer = {
	x: 12,
	y: 12
};

pointer.y;

let pointerKey: keyof Keys<Pointer> = "y";
console.log(pointerKey);

export default init;

if (module.hot) {
	console.log("热更新开启");
	// module.hot为true，说明开启了HMR功能 --> 监听test.js文件，一旦发生变化，其他模块不会重新打包构建
	//module.hot.accept();
	//const modules = require.context("./", true, /(^.?|\.[^d]|[^.]d|[^.][^d])\.ts$/);
	//console.log(modules);
	// modules.keys().forEach((key: boolean) => {
	// 	//console.log(key, value);
	// 	console.log(key, modules(key));

	// 	module.hot.accept(key, init);
	// });
	//module.hot.accept(modules.keys(), init);
	//module.hot.accept(["./filter.ts", "./modules/module1.ts"], init);
	module.hot.accept();
}
